<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 tdansitional//EN" "http://www.w3.org/td/xhtml1/DTD/xhtml1-tdansitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>设备总表</title>
<script src="../js/jQuery1.82.js" type="text/javascript"></script>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<link href="../css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
        function getCom(page){
        	$.post("totalsb",{
        		requestPage:page
			},function(data){
				var json = data.dev;
				$(".resultList").remove();
				for(var i=0;i<(json.length-1);i++){
				    $("#infos").append("<tr class='resultList' style='height:20px;' align='center'>"
				            +"<td style='width:20%'>"+json[i].name+"</td>"
				            +"<td style='width:10%'>"+json[i].devid+"</td>"
				            +"<td style='width:10%'>"+json[i].devmodel+"</td>"
				            +"<td style='width:10%'>"+json[i].devmdate+"</td>"
				            +"<td style='width:10%'>"+json[i].devedate+"</td>"
				            +"<td style='width:10%'>"+json[i].devvender+"</td>"
				            +"<td style='width:10%'>"+json[i].depart+"</td>"
				            +"<td style='width:5%'>"+json[i].username+"</td>"
				            +"<td style='width:15%'>"+json[i].devremark+"</td></tr>");
				}
				$("#totalset").html(json[json.length-1].totalPage);
				$("#curpage").html(json[json.length-1].curPage);
				if(json[json.length-1].curPage<json[json.length-1].totalPage){
					$("#nextpage").attr("dir",json[json.length-1].curPage);
				}
				if(json[json.length-1].curPage>1){
					$("#prepage").attr("dir",json[json.length-1].curPage);
				}
			},"json");
        }
        $(document).ready(function() {  
        	getCom(1);
        /*Get next page */
		$("#nextpage").live("click", function(){
			if($("#nextpage").attr("dir")!="0"){
			var page = parseInt($("#nextpage").attr("dir"))+1;
			getCom(page);}
			});
		/*Get preceding page */
		$("#prepage").live("click", function(){
			if($("#nextpage").attr("dir")!="0"){
			var page = parseInt($("#prepage").attr("dir"))-1;
			getCom(page);}
		});
		
		$("#tiao").click(function(){
			if($("p").val()>1&&$("p").val()<$("#totalset").html()){
			getCom(1);}
		});
        });
</script>
</head>

<body class="ContentBody">
  <table style="width:100%; height:100%;" border="1px" cellspacing="0px" cellpadding="4px" id="infos">
    <tr align="center"><td colspan="9" style="font-size:16px; font-weight:900;" class="tablestyle_title">设备总表</td></tr>
    <tr style="height:20px;" class="zsd" align="center">
      <td style="width:20%">设备名称</td>
      <td style="width:10%">设备编号</td>
      <td style="width:10%">规格型号</td>
      <td style="width:10%">制造日期</td>
      <td style="width:10%">年限</td>
      <td style="width:10%">生产厂家</td>
      <td style="width:10%">使用地点</td>
      <td style="width:5%">使用人</td>
      <td style="width:15%">备注</td>
    </tr>
  </table>
  <table width="100%">
  	<tr>
          <td height="33"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="right-font08">
              <tr>
                <td width="50%">共 <span id="totalset" class="right-text09" >5</span> 页 | 第 <span id="curpage" class="right-text09">1</span> 页</td>
                <td width="49%" align="right">[<a id="headpage" href="#" class="right-font08"></a> | <a id="prepage" dir="0" href="#" class="right-font08">上一页</a> | 
                <a id="nextpage" dir="0" href="#" class="right-font08">下一页</a> | <a id="finalpage" href="#" class="right-font08"></a>]</td>
                <td width="1%"><table width="20" border="0" cellspacing="0" cellpadding="0">
                    <!--  <tr>
                      <td width="1%"><input id="p" name="textfield3" type="text" class="right-textfield03" size="1" /></td>
                      <td width="87%"><input id="tiao" name="Submit23222" type="submit" class="right-button06" value=" " />
                      </td>
                    </tr>-->
                </table></td>
              </tr>
          </table></td>
     </tr>
  </table>
</body>
</html>
